package com.yys.zproject.controller.user;

import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpSession;

import java.io.IOException;

/**
 * @author 14343
 * @version 1.0
 * @date 2025/9/24 20:08
 * @description: TODO
 */
@WebServlet("/user/logout")
public class UserLogoutController extends HttpServlet {
    @Override
    protected void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws IOException {
       doPost(req, resp);
    }
    @Override
    protected void doPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws IOException {
        HttpSession session = req.getSession();
        session.removeAttribute("loginUser");
        resp.sendRedirect("/zpro/index.jsp");
    }
}

